<?php

class TaiKhoan extends CI_Controller
{
	function taotaikhoan()
	{
		$username = $this->input->post('username');
		$password = $this->input->post('password');
		$hoten = $this->input->post('hoten');
		$email = $this->input->post('email');
		$phone = $this->input->post('phone');
		$company = $this->input->post('company');
		$address = $this->input->post('address');
		if($this->mtaikhoan->kiemtrataikhoan($username))
		{
			$data = array(
				'message'=>'Tai khoan '.$username.' da ton tai '.anchor('templateuser/register', 'dang ki lai'),
				'page'=>'message'
			);
			$this->load->view('templateuser', $data);
		}
		else
		{
			$this->mtaikhoan->dangki($username, $password, $hoten, $email, $phone, $company, $address);
			$data = array(
				'message'=>'Dang ki tai khoan thanh cong.',
				'page'=>'message'
			);
			$this->load->view('templateuser', $data);
		}
	}
}

?>